package com.inplaceedit.client.ui.note;

import java.util.Date;

import com.google.gwt.core.client.GWT;
import com.google.gwt.editor.client.LeafValueEditor;
import com.google.gwt.i18n.client.DateTimeFormat;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.DateLabel;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.Widget;

public class NoteDisplayView extends Composite implements NoteEditor {

	interface Binder extends UiBinder<Widget, NoteDisplayView> {
	}

	private static Binder uiBinder = GWT.create(Binder.class);

	@UiField(provided = true)
	DateLabel time;
	@UiField
	Label text;

	public NoteDisplayView() {
		time = new DateLabel(
				DateTimeFormat
						.getFormat(DateTimeFormat.PredefinedFormat.DATE_TIME_SHORT));
		initWidget(uiBinder.createAndBindUi(this));
	}

	@Override
	public LeafValueEditor<String> getTextEditor() {
		return text.asEditor();
	}

	@Override
	public LeafValueEditor<Date> getTimeEditor() {
		return time.asEditor();
	}
}
